import smtplib
from email.mime.text import MIMEText

# 服务器
SMTPserver = "smtp.163.com"
# 发送邮件的地址
sender = "15735184034@163.com"
# 授权密码（不等同于登录密码）
password = "li1997"

# 发送的信息
message = "lilei is a good man"

# 转为邮件文本
msg = MIMEText(message)

# 邮件主题
msg["Subject"] = "python test"

# 邮件的发送者
msg["From"] = sender

# 链接smtp服务器
mailServer = smtplib.SMTP(SMTPserver, 25)

# 登录
mailServer.login(sender, password)

# 发送邮件
mailServer.sendmail(sender, "1739195020@qq.com", msg.as_string())
mailServer.quit()